package com.service.impl;

import com.dao.DormitoryDao;
import com.pojo.Dormitory;
import com.service.IDormitoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class DormitoryServiceImpl implements IDormitoryService {

    @Autowired
    DormitoryDao dormitoryDao;

    @Override
    @Transactional
    public List<Dormitory> FindAllBuild() {
        return dormitoryDao.FindAllDormitory();
    }

    @Override
    @Transactional
    public Integer deleteDormitory(String id) {
        return dormitoryDao.deleteById(id);
    }

    @Override
    @Transactional
    public Integer addDormitory(String  id,String bid) {
        return dormitoryDao.addDormitory(id,bid);
    }

    @Override
    @Transactional
    public Integer updateDormitory(String id, String bid) {
        return dormitoryDao.updateDormitory(id,bid);
    }

    @Transactional
    @Override
    public String selectBuildByName(String dormitoryName) {
        String buildname = dormitoryDao.selectBuildByName(dormitoryName);
        return buildname;
    }
}
